package com.yj.music_center;

import com.yj.music_center.callback.impl.CallbackImpl;

import io.flutter.plugin.common.EventChannel;

public class StreamHandlerImpl implements EventChannel.StreamHandler{

    private EventChannel.EventSink eventSink;

    @Override
    public void onListen(Object arguments, EventChannel.EventSink events) {
        eventSink = events;
        CallbackImpl.getInstance().setEventSink(eventSink);
    }

    @Override
    public void onCancel(Object arguments) {
        eventSink.endOfStream();
        eventSink = null;
    }
}
